package com.tianyu.jty.collector.entity;

import com.google.common.collect.Maps;
import com.tianyu.jty.content.entity.Topic;

import java.util.List;
import java.util.Map;

/**
 * Created by xtao on 2015/11/8.
 */
public class Site {
    private String url;
    private Map<String, String> name2selector;
    private Map<String, String> name2method;
    private List<String> jsonKeys;
    private boolean onlyOneExtract;
    private SiteType type;
    private Topic topic;
    private Map<String ,Object> result = Maps.newHashMap();

    public Site(String url, SiteType type, Topic topic) {
        this.url = url;
        this.type = type;
        this.topic = topic;
    }

    public Site withName2Selector(Map<String, String> name2selector) {
        this.setName2selector(name2selector);
        return this;
    }

    public Site withName2method(Map<String , String> name2method) {
        this.setName2method(name2method);
        return this;
    }

    public Site withJsonKeys(List<String> jsonKeys) {
        this.setJsonKeys(jsonKeys);
        return this;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Map<String, String> getName2selector() {
        return name2selector;
    }

    public void setName2selector(Map<String, String> name2selector) {
        this.name2selector = name2selector;
    }

    public Map<String, String> getName2method() {
        return name2method;
    }

    public void setName2method(Map<String, String> name2method) {
        this.name2method = name2method;
    }

    public boolean isOnlyOneExtract() {
        return onlyOneExtract;
    }

    public void setOnlyOneExtract(boolean onlyOneExtract) {
        this.onlyOneExtract = onlyOneExtract;
    }

    public SiteType getType() {
        return type;
    }

    public void setType(SiteType type) {
        this.type = type;
    }

    public Topic getTopic() {
        return topic;
    }

    public void setTopic(Topic topic) {
        this.topic = topic;
    }

    public Map<String, Object> getResult() {
        return result;
    }

    public void setResult(Map<String, Object> result) {
        this.result = result;
    }

    public List<String> getJsonKeys() {
        return jsonKeys;
    }

    public void setJsonKeys(List<String> jsonKeys) {
        this.jsonKeys = jsonKeys;
    }
}
